Developer --> Technical Publications

     


Handling Events in Response to Display Manager Changes

Users indirectly inform the Display Manager of changes they wish to make to their display environment by using the Monitors control panel, or by attaching or removing additional displays. The Display Manager in turn sends an Apple event--the Display Notice event--to notify applications that the display environment has changed.

After changing the display environment, the Display Manager also generates an update event to notify all current applications to update their windows.

Your application should always handle update events for its windows. However, your application needs to respond to the Display Notice event only if your application repositions its own windows, uses nonstandard windows, or must update any display information that it stores internally.

To receive the Display Notice event informing you of changes to the user's display configuration, you must either

If you write a utility--such as a control panel--that does not handle events through a normal event loop, or if you want your application to handle the Display Notice event as soon as it is issued instead of waiting for it to appear in the event queue, you should use the DMRegisterExtendedNotifyProc function.

Here is a summary of the Display Notice event (remember that you must use Apple Event Manager functions to obtain the information contained in Apple events such as this):

Display Notice--respond to display configuration changes

Event class
kCoreEventClass
Event ID
kAESystemConfigNotice
Required parameter
Keyword:
kAEDisplayNotice
Descriptor type:
AEDesc
Data:
A list of descriptor structures, each specified by the keyword kDisplayID . Each kDisplayID descriptor structure contains information about a video device attached to the user's system. Within each kDisplayID descriptor structure are a pair of additional keyword-specified descriptor structures: keyDisplayOldConfig and keyDisplayNewConfig . A description of the video device's previous state is saved in the keyDisplayOldConfig descriptor structure, and a description of the video device's current state is saved in the keyDisplayNewConfig descriptor structure.

Descriptions of these keyword-specified descriptor structures are in Table 3-1.

Requested action

Ensure that all windows appear to the user, and update any necessary display information that your application or utility stores internally.

Table 3-1 Keyword-specified descriptor structures
Keyword Value Type Description
keyDeviceDepthMode 'dddm' typeLongInteger The depth mode for the video device; that is, the value of the gdMode field in the GDevice structure for the device
keyDeviceFlags 'dddf' typeShortInteger The attributes for the video device as maintained in the gdFlags field of the GDevice structure for the device
keyDeviceRect 'dddr' typeQDRectangle The boundary rectangle of the video device; that is, the value of the gdRect field in the GDevice structure for the device
keyDisplayDevice 'dmdd' typeLongInteger A handle to the GDevice structure for the video device
keyDisplayID 'dmid' typeLongInteger The display ID for the video device
keyDisplayMode 'dmdm' typeLongInteger The sResource number from the video device for this display mode
keyDMConfigVersion 'dmcv' typeLongInteger The version number for this Display Notice event
keyPixMapAlignment 'dppa' typeLongInteger Reserved for future use
keyPixMapCmpCount 'dpcc' typeShortInteger The number of components used to represent a color for a pixel; that is, the value of the cmpCount field in the PixMap structure for the GDevice structure for the device
keyPixMapCmpSize 'dpcs' typeShortInteger The size in bits of each component for a pixel; that is, the value of the cmpSize field in the PixMap structure for the GDevice structure for the device
keyPixMapColorTableSeed 'dpct' typeLongInteger The value of the ctSeed field of the ColorTable structure for the PixMap structure for the GDevice structure for the video device
keyPixMapHResolution 'dphr' typeFixed he horizontal resolution of the pixel image in the PixMap structure for the GDevice structure for the video device
keyPixMapPixelSize 'dpps' typeShortInteger Pixel depth for the device; that is, the value of the pixelSize field in the PixMap structure for the GDevice structure for the video device
keyPixMapPixelType 'dppt' typeShortInteger The storage format for the pixel image on the device; that is, the value of the pixelType field in the PixMap structure for the GDevice structure for the video device
keyPixMapRect 'dpdr' typeQDRectangle The boundary rectangle into which QuickDraw can draw; that is, the bounds field in the PixMap structure for the GDevice structure for the video device
keyPixMapReserved 'dppr' typeLongInteger Reserved for future use
keyPixMapResReserved 'dprr' typeLongInteger Reserved for future use
keyPixMapVResolution 'dpvr' typeFixed The vertical resolution of the pixel image in the PixMap structure for the GDevice structure for the video device

© 2000 Apple Computer, Inc. (Last Updated 07 April 00)